package com.cckj.projectapi.module.open.controller;

import com.cckj.projectapi.module.open.service.CommonService;
import com.cckj.projectapi.module.open.vo.PhoneLoginVo;
import com.cckj.common.response.ResultData;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 公用无授权api
 *
 * @author chengni
 * @date 2021/8/20 上午9:37
 */
@RestController
@RequestMapping("/open/common")
public class CommonController {

    @Resource
    CommonService commonService;

    /**
     * 获取手机验证码
     * @Author chengni
     * @time: 2021/8/20 上午9:41
     */
    @GetMapping("getSmsCode")
    public ResultData getSmsCode(String phone){
        return commonService.getSmsCode(phone);
    }


    /**
     * 手机号登陆或注册
     * @Author chengni
     * @time: 2021/8/20 下午12:21
     */
    @PostMapping("phoneLogin")
    public ResultData phoneLogin(@RequestBody @Valid PhoneLoginVo vo){
        return commonService.phoneLogin(vo);
    }

}
